package demo4;

public class Derived extends Base {
    int a = 10;
    int b = 20;
    public void method() {
        System.out.println(a);
        System.out.println(b);
        // 通过 super 关键字访问父类同名成员
        System.out.println(super.a);
        System.out.println(super.b);
    }
    public void methodA() {
        System.out.println("Derived中的methodA()");
    }
    public void methodB() {
        super.methodA();
    }
    public static void main(String[] args) {
        Derived derived = new Derived();
        derived.method();
        derived.methodA();
        derived.methodB();
    }
}

